package com.example.swordjava;


public class Test45 {

    public static void main(String[] args) {

        int[][] a = {{1, 2, 3, 4},
                {5, 6, 7, 8},
                {9, 10, 11, 12},
                {13, 14, 15, 16}};

        System.out.println(Math.pow(1, 10));

    }

    public class TreeNode {
        int val = 0;
        TreeNode left = null;
        TreeNode right = null;

        public TreeNode(int val) {
            this.val = val;

        }
    }

    /**
     * 把数组排成最小的数
     * 输入一个非负整数数组numbers，把数组里所有数字拼接起来排成一个数，打印能拼接出的所有数字中最小的一个。
     * 例如输入数组[3，32，321]，则打印出这三个数字能排成的最小数字为321323。
     */
    public String PrintMinNumber(int[] numbers) {
        // write code here
        for (int i = 0; i < numbers.length; i++) {
            for (int j = i + 1; j < numbers.length; j++) {
                int a = Integer.valueOf(String.valueOf(numbers[i]) + numbers[j]);
                int b = Integer.valueOf(String.valueOf(numbers[j]) + numbers[i]);
                if (a > b) {
                    int temp = numbers[i];
                    numbers[i] = numbers[j];
                    numbers[j] = temp;
                }
            }
        }

        String ans = "";
        for (int i = 0; i < numbers.length; i++) {
            ans += numbers[i];
        }
        return ans;
    }

}














